#!
import os
import shutil

def move(srcfile,dstfile):
	print("From",srcfile)
	print("\tTo", dstfile)
	if(os.path.isfile(srcfile)):
		shutil.copy(srcfile,dstfile)
		os.remove(srcfile)
	elif(os.path.isdir(srcfile)):
		shutil.copytree(srcfile,dstfile)
		shutil.rmtree(srcfile)

srcDir='D:\\Temp'
dstDir='D:\\'
dirList=os.listdir(path=srcDir)
for f in dirList:
	ft=f.lower();
	if((len(ft)>6)and(ft[:5]=='share')and((ft[5]=='-')or(ft[5]=='_'))):
		if((ft[6:9]=='sft')and((ft[9]=='-')or(ft[9]=='_'))):
#			ftts=srcDir+os.sep+f
#			fttd=dstDir+os.sep+"Software"+os.sep+f[10:]
			ftts=os.path.join(srcDir,f)
			fttd=os.path.join(dstDir,"Software",f[10:])
			print("To Software:",f)
			move(ftts,fttd);
		elif(ft[6:9]=='doc'and((ft[9]=='-')or(ft[9]=='_'))):
#			ftts=srcDir+os.sep+f
#			fttd=dstDir+os.sep+"Document"+os.sep+f[10:]
			ftts=os.path.join(srcDir,f)
			fttd=os.path.join(dstDir,"Document",f[10:])
			print("To Document:",f)
			move(ftts,fttd);
		
#print(dirList)